package com.ss.android.common.download;

import android.content.Context;

import com.bytedance.common.utility.reflect.Reflect;

import java.util.Map;

public class DownloadAdapterProxy implements IDownloadAdapter {
    private static volatile DownloadAdapterProxy a;
    private IDownloadAdapter mDownloadAdapterImpl;

    private DownloadAdapterProxy() {
        this.mDownloadAdapterImpl = null;
        try {
            Object v0_1 = Reflect.onClass(Reflect.forName("com.ss.android.download.DownloadAdapter")).create().target;
            if (v0_1 == null) {
                return;
            }
            this.mDownloadAdapterImpl = ((IDownloadAdapter) v0_1);
        } catch (Throwable v0) {
            v0.printStackTrace();
        }
    }

    public static synchronized DownloadAdapterProxy inst() {
        if (a == null) {
            synchronized (DownloadAdapterProxy.class) {
                if (a == null) {
                    a = new DownloadAdapterProxy();
                }
            }
        }
        return a;
    }

    public long addDownloadTask(String arg11, String arg12, boolean arg13, Context arg14, String arg15, Map arg16, boolean arg17, boolean arg18, boolean arg19) {
        long v0 = this.mDownloadAdapterImpl != null ? this.mDownloadAdapterImpl.addDownloadTask(arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19) : -1;
        return v0;
    }

    public String getDownloadExtra(Context arg3, long arg4) {
        String v0 = this.mDownloadAdapterImpl != null ? this.mDownloadAdapterImpl.getDownloadExtra(arg3, arg4) : "";
        return v0;
    }

    public String getFailedReson(Context arg3, long arg4) {
        String v0 = this.mDownloadAdapterImpl != null ? this.mDownloadAdapterImpl.getFailedReson(arg3, arg4) : "";
        return v0;
    }

    public void handleAppInstalled(Context arg2, String arg3) {
        if (this.mDownloadAdapterImpl != null) {
            this.mDownloadAdapterImpl.handleAppInstalled(arg2, arg3);
        }
    }

    public void handleStatusClick(Context arg8, int arg9, long arg10, String arg12) {
        if (this.mDownloadAdapterImpl != null) {
            this.mDownloadAdapterImpl.handleStatusClick(arg8, arg9, arg10, arg12);
        }
    }

    public boolean isDownloadSuccessAndFileNotExist(Context arg2, DownloadShortInfo arg3) {
        boolean v0 = this.mDownloadAdapterImpl != null ? this.mDownloadAdapterImpl.isDownloadSuccessAndFileNotExist(arg2, arg3) : false;
        return v0;
    }

    public DownloadShortInfo queryDownloadInfo(Context arg2, String arg3) {
        DownloadShortInfo v0 = this.mDownloadAdapterImpl != null ? this.mDownloadAdapterImpl.queryDownloadInfo(arg2, arg3) : null;
        return v0;
    }

    public void registerDownloadListener(Context arg8, Long arg9, DownloadInfoChangeListener arg10, String arg11, int arg12, String arg13) {
        if (this.mDownloadAdapterImpl != null) {
            this.mDownloadAdapterImpl.registerDownloadListener(arg8, arg9, arg10, arg11, arg12, arg13);
        }
    }

    public void unregisterDownloadListener(Context context, Long downloadId, DownloadInfoChangeListener downloadInfoChangeListener) {
        if (this.mDownloadAdapterImpl != null) {
            this.mDownloadAdapterImpl.unregisterDownloadListener(context, downloadId, downloadInfoChangeListener);
        }
    }
}

